package com.bestcem.xm.ticket.service.manager.notify;

import com.bestcem.xm.ticket.enums.TicketNotifyConfigEventEnum;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 工单邮件通知模板
 *
 * @author gy.liu
 * @version 1.0
 * @date 2021/8/23 15:51
 **/

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class EmailTemplate {

    /**
     * 工单创建邮件通知模板
     */
    public static String TICKET_SYSTEM_CREATED_EMAIL_TEMPLATE = "[{surveyTitle}]收到新的{ticketType}，请登录[{sysName}]查看。<br>\n" +
            "{ticketType}编号：{ticketNo}<br>\n" +
            "{ticketType}链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "{ticketType}生成时间：{createdDT}<br>\n" +
            "处理逾期时间：{followDeadline}<br>\n" +
            "触发规则：{ticketRule}<br>";

    /**
     * 处理逾期前提醒邮件通知模板
     */
    public static String TICKET_FOLLOW_OVERDUE_REMIND_EMAIL_TEMPLATE = "[{surveyTitle}]工单处理即将逾期，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "处理逾期时间：{followDeadline}<br>\n" +
            "触发规则：{ticketRule}<br>";

    /**
     * 处理已逾期提醒邮件通知模板
     */
    public static String TICKET_FOLLOW_OVERDUE_EMAIL_TEMPLATE = "[{surveyTitle}]以下工单已经处理逾期，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "处理逾期时间：{followDeadline}<br>\n" +
            "触发规则：{ticketRule}<br>";

    /**
     * 收到审核邮件通知模板
     */
    public static String TICKET_AUDITING_EMAIL_TEMPLATE = "[{surveyTitle}]收到新的工单审核，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "审核逾期时间：{auditDeadline}<br>";

    /**
     * 审核逾期前提醒邮件通知模板
     */
    public static String TICKET_AUDIT_OVERDUE_REMIND_EMAIL_TEMPLATE = "[{surveyTitle}]以下工单审核即将逾期，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "审核逾期时间：{auditDeadline}<br>";

    /**
     * 审核已逾期提醒邮件通知模板
     */
    public static String TICKET_AUDIT_OVERDUE_EMAIL_TEMPLATE = "[{surveyTitle}]以下工单审核逾期，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "审核逾期时间：{auditDeadline}<br>";

    /**
     * 工单转派处理邮件通知模板
     */
    public static String TICKET_TRANSFER_FOLLOW_EMAIL_TEMPLATE = "[{surveyTitle}]收到新的工单，请登录[{sysName}]查看。<br>\n" +
            "工单编号：{ticketNo}<br>\n" +
            "工单链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "工单生成时间：{createdDT}<br>\n" +
            "工单生成规则：{alertRuleTitle}<br>\n" +
            "触发规则：{ticketRule}<br>";

    /**
     * 工单仅通知模板
     */
    public static String TICKET_ONLY_NOTIFY_EMAIL_TEMPLATE = "[{surveyTitle}]收到新的{ticketType}，请登录[{sysName}]查看。<br>\n" +
            "{ticketType}编号：{ticketNo}<br>\n" +
            "{ticketType}链接：<a class=\"blue\" href=\"{url}\" target=\"_blank\">{url}</a><br>\n" +
            "{ticketType}生成时间：{createdDT}<br>\n" +
            "触发规则：{ticketRule}<br>";

    public static final Map<String, String> MESSAGE_TYPE = new HashMap<>();

    static {
        MESSAGE_TYPE.put("notify", "（通知类）");
    }

    public static final Map<String, String> TICKET_TYPE = new HashMap<>();

    static {
        TICKET_TYPE.put("0", "预警");
        TICKET_TYPE.put("1", "工单");
    }

    public static final Map<TicketNotifyConfigEventEnum, Map<String, String>> TEMPLATE__MAP = new HashMap<>();

    static {
        Map<String, String> NOTIFY_FOLLOW = new HashMap<>();
        NOTIFY_FOLLOW.put("subject", "[{surveyTitle}]收到新的{ticketType}");
        NOTIFY_FOLLOW.put("content", TICKET_SYSTEM_CREATED_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.CREATED_TICKET, NOTIFY_FOLLOW);

        Map<String, String> NOTIFY_FOLLOW_REMIND = new HashMap<>();
        NOTIFY_FOLLOW_REMIND.put("subject", "[{surveyTitle}]工单处理即将逾期");
        NOTIFY_FOLLOW_REMIND.put("content", TICKET_FOLLOW_OVERDUE_REMIND_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.FOLLOW_REMIND, NOTIFY_FOLLOW_REMIND);

        Map<String, String> NOTIFY_FOLLOW_OVERDUE = new HashMap<>();
        NOTIFY_FOLLOW_OVERDUE.put("subject", "[{surveyTitle}]工单处理逾期");
        NOTIFY_FOLLOW_OVERDUE.put("content", TICKET_FOLLOW_OVERDUE_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.FOLLOW_OVERDUE, NOTIFY_FOLLOW_OVERDUE);

        Map<String, String> NOTIFY_AUDIT = new HashMap<>();
        NOTIFY_AUDIT.put("subject", "[{surveyTitle}]收到新的工单审核");
        NOTIFY_AUDIT.put("content", TICKET_AUDITING_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.RECEIVE_AUDIT, NOTIFY_AUDIT);

        Map<String, String> NOTIFY_AUDIT_REMIND = new HashMap<>();
        NOTIFY_AUDIT_REMIND.put("subject", "[{surveyTitle}]工单审核即将逾期");
        NOTIFY_AUDIT_REMIND.put("content", TICKET_AUDIT_OVERDUE_REMIND_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.AUDIT_REMIND, NOTIFY_AUDIT_REMIND);

        Map<String, String> NOTIFY_AUDIT_OVERDUE = new HashMap<>();
        NOTIFY_AUDIT_OVERDUE.put("subject", "[{surveyTitle}]工单审核逾期");
        NOTIFY_AUDIT_OVERDUE.put("content", TICKET_AUDIT_OVERDUE_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.AUDIT_OVERDUE, NOTIFY_AUDIT_OVERDUE);

        Map<String, String> NOTIFY_TRANSFER = new HashMap<>();
        NOTIFY_TRANSFER.put("subject", "[{surveyTitle}]收到新的{ticketType}");
        NOTIFY_TRANSFER.put("content", TICKET_TRANSFER_FOLLOW_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.CHANGE_FOLLOW, NOTIFY_TRANSFER);

        Map<String, String> TICKETNOTIFYCONFIG_EVENT_ONLY_NOTIFY = new HashMap<>();
        TICKETNOTIFYCONFIG_EVENT_ONLY_NOTIFY.put("subject", "[{surveyTitle}]收到新的{ticketType}");
        TICKETNOTIFYCONFIG_EVENT_ONLY_NOTIFY.put("content", TICKET_ONLY_NOTIFY_EMAIL_TEMPLATE);
        TEMPLATE__MAP.put(TicketNotifyConfigEventEnum.ONLY_NOTIFY, TICKETNOTIFYCONFIG_EVENT_ONLY_NOTIFY);
    }

}
